package org.dromara.system.controller.api;

import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.system.service.ISysPermissionService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

/**
 * @author: zhou shuai
 * @date: 2025/7/12 16:01
 * @version: v1
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/system/permission")
public class SysPermissionApiController {

    private final ISysPermissionService sysPermissionService;

    /**
     * 获取角色数据权限
     */
    @GetMapping("/role")
    public R<Set<String>> getRolePermission(@RequestParam("userId") Long userId) {
        return R.ok(sysPermissionService.getRolePermission(userId));
    }

    /**
     * 获取菜单数据权限
     */
    @GetMapping("/menu")
    public R<Set<String>> getMenuPermission(@RequestParam("userId") Long userId) {
        return R.ok(sysPermissionService.getMenuPermission(userId));
    }

}
